package com.christophpurrer.shg3;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Vibrator;
import android.widget.Toast;

import com.christophpurrer.R;

public class ShakeListenerTestActivity3 extends Activity {
	private ShakeListener mShaker;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shaking_gestures3);

		final Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

		mShaker = new ShakeListener(this);
		mShaker.setOnShakeListener(new ShakeListener.OnShakeListener() {
			public void onShake() {
				vibrator.vibrate(100);
				Toast.makeText(ShakeListenerTestActivity3.this, "Shake!",
						Toast.LENGTH_SHORT).show();
				// new
				// AlertDialog.Builder(ShakeListenerTestActivity3.this).setPositiveButton(android.R.string.ok,
				// null).setMessage("Shooken!").show();
			}
		});
	}

	@Override
	public void onResume() {
		mShaker.resume();
		super.onResume();
	}

	@Override
	public void onPause() {
		mShaker.pause();
		super.onPause();
	}
}